<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>交易记录</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/admin.css') }}">
</head>
<body>
    <div class="main-content">
        <h2>交易记录</h2>
        <table>
            <tr>
                <th>订单ID</th>
                <th>客户ID</th>
                <th>用户名</th>
                <th>产品名</th>
                <th>数量</th>
                <th>价格</th>
                <th>订单日期</th>
                <th>状态</th>
            </tr>
            {% for order in orders %}
            <tr>
                <td>{{ order[0] }}</td>
                <td>{{ order[1] }}</td>
                <td>{{ order[2] }}</td>
                <td>{{ order[3] }}</td>
                <td>{{ order[4] }}</td>
                <td>{{ order[5] }}</td>
                <td>{{ order[6] }}</td>
                <td>{{ order[7] }}</td>
            </tr>
            {% endfor %}
        </table>
        <div class="pagination">
            {% if page > 1 %}
                <a href="{{ url_for('admin_orders', page=page-1) }}">上一页</a>
            {% endif %}
            {% for p in range(1, total_pages + 1) %}
                {% if p == page %}
                    <span>{{ p }}</span>
                {% else %}
                    <a href="{{ url_for('admin_orders', page=p) }}">{{ p }}</a>
                {% endif %}
            {% endfor %}
            {% if page < total_pages %}
                <a href="{{ url_for('admin_orders', page=page+1) }}">下一页</a>
            {% endif %}
        </div>
    </div>
</body>
</html>
